<template>
  <div class="bag">
    <div>正在装备中：</div>
    <el-row :gutter="0">
      <el-col :span="6" v-for="(value, index) in equipingbag" :key="index">
        <div class="grid-content bg-purple">
          <el-card :body-style="{ padding: '0px' }">
            <div style="padding: 14px">
              <span style="font-size: 20px">{{ value.equipment.name }}</span>
              <div style="font-size: 16px">
                <span>属性加成：</span>
                <div>力量：{{ value.strength }}</div>
                <div>体质：{{ value.defense }}</div>
                <div>灵力：{{ value.magic }}</div>
                <div>速度：{{ value.speed }}</div>
                <div>命中加成：{{ value.accuracy }}</div>
              </div>
              <div v-if="value.skill">
                <div>特技：{{ value.skill.name }}</div>
                <div>
                  特技效果：
                  <div v-if="value.skill.ad != '0'">
                    获得{{ value.skill.ad }}点物理伤害加成。
                  </div>
                  <div v-if="value.skill.ap != '0'">
                    获得{{ value.skill.ap }}点法术伤害加成。
                  </div>
                </div>
              </div>
              <div v-else>
                <div>特技：无</div>
                <div>特技描述：无</div>
              </div>
              <div class="bottom clearfix" v-if="value.status == '0'">
                <el-button
                  type="text"
                  class="button"
                  @click="equipon('on', value._id)"
                  >装 备</el-button
                >
              </div>
              <div class="bottom clearfix" v-if="value.status == '1'">
                <el-button
                  type="text"
                  class="button"
                  @click="equipon('off', value._id)"
                  >卸 下</el-button
                >
              </div>
            </div>
          </el-card>
        </div>
      </el-col>
    </el-row>
    <template>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label=" 道 具 " name="good">
          <el-table
            v-if="userbag.length > 0"
            :data="userbag"
            border
            style="width: 95%; margin-bottom: 2%"
            height="720"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="goods.name" label="道具名字">
              <template slot-scope="scope">
                <span>{{ scope.row.goods.name }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="goods.info" label="描述">
              <template slot-scope="scope">
                <span>{{ scope.row.goods.info }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作" fixed="right">
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  @click="usebutton(scope.row._id)"
                  >使 用</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- <el-row :gutter="0">
            <el-col :span="4" v-for="(value, index) in userbag" :key="index">
              <div class="grid-content bg-purple">
                <el-card :body-style="{ padding: '0px' }">
                  <div style="padding: 14px">
                    <div style="padding-bottom: 3px">
                      道具名字：
                      <span style="font-size: 18px">
                        {{ value.goods.name }}</span
                      >
                    </div>
                    <div>描述：{{ value.goods.info }}</div>
                    <div class="bottom clearfix">
                      <el-button type="text" class="button" @click="usebutton()"
                        >使 用</el-button
                      >
                    </div>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row> -->
        </el-tab-pane>
        <el-tab-pane label=" 武 器 " name="weapon">
          <el-table
            v-if="weaponbag.length > 0"
            :data="weaponbag"
            border
            style="width: 95%; margin-bottom: 2%"
            height="720"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="equipment.name" label="装备名字" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.name }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="equipment.info" label="描 述" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.info }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="strength" label="力量">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-hand-rock-o"></i>
                  {{ scope.row.strength }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="defense" label="体质">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-male"></i>
                  {{ scope.row.defense }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="magic" label="灵力">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-bolt"></i>
                  {{ scope.row.magic }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="speed" label="速度">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-blind"></i>
                  {{ scope.row.speed }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="accuracy" label="命中">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-eye"></i>
                  {{ scope.row.accuracy }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="skill.name" label="特技"> </el-table-column>
            <el-table-column prop="skill.ad" label="特技描述">
            </el-table-column>
            <el-table-column
              prop="status"
              align="center"
              label="操作"
              fixed="right"
              width="180"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
            >
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('on', scope.row._id)"
                  >穿戴</el-button
                >
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('on', scope.row._id)"
                  disabled
                  >穿戴</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('off', scope.row._id)"
                  disabled
                  >卸下</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('off', scope.row._id)"
                  >卸下</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- <el-row :gutter="0">
            <el-col :span="4" v-for="(value, index) in weaponbag" :key="index">
              <div class="grid-content bg-purple">
                <el-card :body-style="{ padding: '0px' }">
                  <div style="padding: 10px">
                    <div style="padding-bottom: 3px">
                      装备名字：
                      <span style="font-size: 18px">{{
                        value.equipment.name
                      }}</span>
                    </div>
                    <div>描述：{{ value.equipment.info }}</div>
                    <div>
                      <span>属性加成：</span>
                      <div>力量：{{ value.strength }}</div>
                      <div>体质：{{ value.defense }}</div>
                      <div>灵力：{{ value.magic }}</div>
                      <div>速度：{{ value.speed }}</div>
                      <div>命中加成：{{ value.accuracy }}</div>
                    </div>
                    <div v-if="value.skill">
                      <div>特技：{{ value.skill.name }}</div>
                      <div>
                        特技效果：
                        <div v-if="value.skill.ad != '0'">
                          获得{{ value.skill.ad }}点物理伤害加成。
                        </div>
                        <div v-if="value.skill.ap != '0'">
                          获得{{ value.skill.ap }}点法术伤害加成。
                        </div>
                      </div>
                    </div>
                    <div v-else>
                      <div>特技：无</div>
                      <div>特技描述：无</div>
                      <br />
                      <br />
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '0'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('on', value._id)"
                        >装 备</el-button
                      >
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '1'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('off', value._id)"
                        >卸 下</el-button
                      >
                    </div>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row> -->
        </el-tab-pane>
        <el-tab-pane label=" 衣 服 " name="clothes">
          <el-table
            v-if="clothesbag.length > 0"
            :data="clothesbag"
            border
            style="width: 95%; margin-bottom: 2%"
            height="720"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="equipment.name" label="装备名字" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.name }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="equipment.info" label="描 述" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.info }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="strength" label="力量">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-hand-rock-o"></i>
                  {{ scope.row.strength }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="defense" label="体质">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-male"></i>
                  {{ scope.row.defense }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="magic" label="灵力">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-bolt"></i>
                  {{ scope.row.magic }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="speed" label="速度">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-blind"></i>
                  {{ scope.row.speed }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="accuracy" label="命中">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-eye"></i>
                  {{ scope.row.accuracy }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="skill.name" label="特技"> </el-table-column>
            <el-table-column prop="skill.ad" label="特技描述">
            </el-table-column>
            <el-table-column
              prop="status"
              align="center"
              label="操作"
              fixed="right"
              width="180"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
            >
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('on', scope.row._id)"
                  >穿戴</el-button
                >
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('on', scope.row._id)"
                  disabled
                  >穿戴</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('off', scope.row._id)"
                  disabled
                  >卸下</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('off', scope.row._id)"
                  >卸下</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- <el-row :gutter="0">
            <el-col :span="4" v-for="(value, index) in clothesbag" :key="index">
              <div class="grid-content bg-purple">
                <el-card :body-style="{ padding: '0px' }">
                  <div style="padding: 14px">
                    <div style="padding-bottom: 3px">
                      装备名字：
                      <span style="font-size: 18px">{{
                        value.equipment.name
                      }}</span>
                    </div>
                    <div>描述：{{ value.equipment.info }}</div>
                    <div>
                      <span>属性加成：</span>
                      <div>力量：{{ value.strength }}</div>
                      <div>体质：{{ value.defense }}</div>
                      <div>灵力：{{ value.magic }}</div>
                      <div>速度：{{ value.speed }}</div>
                      <div>命中加成：{{ value.accuracy }}</div>
                    </div>
                    <div v-if="value.skill">
                      <div>特技：{{ value.skill.name }}</div>
                      <div>
                        特技效果：
                        <div v-if="value.skill.ad != '0'">
                          获得{{ value.skill.ad }}点物理伤害加成。
                        </div>
                        <div v-if="value.skill.ap != '0'">
                          获得{{ value.skill.ap }}点法术伤害加成。
                        </div>
                      </div>
                    </div>
                    <div v-else>
                      <div>特技：无</div>
                      <div>特技描述：无</div>
                      <br />
                      <br />
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '0'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('on', value._id)"
                        >装 备</el-button
                      >
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '1'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('off', value._id)"
                        >卸 下</el-button
                      >
                    </div>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row> -->
        </el-tab-pane>
        <el-tab-pane label=" 鞋 子 " name="shoe">
          <el-table
            v-if="shoebag.length > 0"
            :data="shoebag"
            border
            style="width: 95%; margin-bottom: 2%"
            height="720"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="equipment.name" label="装备名字" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.name }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="equipment.info" label="描 述" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.info }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="strength" label="力量">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-hand-rock-o"></i>
                  {{ scope.row.strength }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="defense" label="体质">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-male"></i>
                  {{ scope.row.defense }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="magic" label="灵力">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-bolt"></i>
                  {{ scope.row.magic }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="speed" label="速度">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-blind"></i>
                  {{ scope.row.speed }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="accuracy" label="命中">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-eye"></i>
                  {{ scope.row.accuracy }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="skill.name" label="特技"> </el-table-column>
            <el-table-column prop="skill.ad" label="特技描述">
            </el-table-column>
            <el-table-column
              prop="status"
              align="center"
              label="操作"
              fixed="right"
              width="180"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
            >
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('on', scope.row._id)"
                  >穿戴</el-button
                >
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('on', scope.row._id)"
                  disabled
                  >穿戴</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('off', scope.row._id)"
                  disabled
                  >卸下</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('off', scope.row._id)"
                  >卸下</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- <el-row :gutter="0">
            <el-col :span="4" v-for="(value, index) in shoebag" :key="index">
              <div class="grid-content bg-purple">
                <el-card :body-style="{ padding: '0px' }">
                  <div style="padding: 14px">
                    <div style="padding-bottom: 3px">
                      装备名字：
                      <span style="font-size: 18px">{{
                        value.equipment.name
                      }}</span>
                    </div>
                    <div>描述：{{ value.equipment.info }}</div>
                    <div>
                      <span>属性加成：</span>
                      <div>力量：{{ value.strength }}</div>
                      <div>体质：{{ value.defense }}</div>
                      <div>灵力：{{ value.magic }}</div>
                      <div>速度：{{ value.speed }}</div>
                      <div>命中加成：{{ value.accuracy }}</div>
                    </div>
                    <div v-if="value.skill">
                      <div>特技：{{ value.skill.name }}</div>
                      <div>
                        特技效果：
                        <div v-if="value.skill.ad != '0'">
                          获得{{ value.skill.ad }}点物理伤害加成。
                        </div>
                        <div v-if="value.skill.ap != '0'">
                          获得{{ value.skill.ap }}点法术伤害加成。
                        </div>
                      </div>
                    </div>
                    <div v-else>
                      <div>特技：无</div>
                      <div>特技描述：无</div>
                      <br />
                      <br />
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '0'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('on', value._id)"
                        >装 备</el-button
                      >
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '1'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('off', value._id)"
                        >卸 下</el-button
                      >
                    </div>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row> -->
        </el-tab-pane>
        <el-tab-pane label=" 戒 指 " name="ring">
          <el-table
            v-if="ringbag.length > 0"
            :data="ringbag"
            border
            style="width: 95%; margin-bottom: 2%"
            height="720"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="equipment.name" label="装备名字" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.name }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="equipment.info" label="描 述" width="180">
              <template slot-scope="scope">
                <span>{{ scope.row.equipment.info }}</span>
              </template>
            </el-table-column>
            <el-table-column prop="strength" label="力量">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-hand-rock-o"></i>
                  {{ scope.row.strength }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="defense" label="体质">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-male"></i>
                  {{ scope.row.defense }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="magic" label="灵力">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-bolt"></i>
                  {{ scope.row.magic }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="speed" label="速度">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-blind"></i>
                  {{ scope.row.speed }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="accuracy" label="命中">
              <template slot-scope="scope">
                <span>
                  <i class="fa fa-eye"></i>
                  {{ scope.row.accuracy }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="skill.name" label="特技"> </el-table-column>
            <el-table-column prop="skill.ad" label="特技描述">
            </el-table-column>
            <el-table-column
              prop="status"
              align="center"
              label="操作"
              fixed="right"
              width="180"
            >
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('on', scope.row._id)"
                  >穿戴</el-button
                >
                <el-button
                  type="primary"
                  icon="edit"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('on', scope.row._id)"
                  disabled
                  >穿戴</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '0'"
                  @click="equipon('off', scope.row._id)"
                  disabled
                  >卸下</el-button
                >
                <el-button
                  type="warning"
                  icon="delete"
                  size="small"
                  v-if="scope.row.status == '1'"
                  @click="equipon('off', scope.row._id)"
                  >卸下</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- <el-row :gutter="0">
            <el-col :span="4" v-for="(value, index) in ringbag" :key="index">
              <div class="grid-content bg-purple">
                <el-card :body-style="{ padding: '0px' }">
                  <div style="padding: 14px">
                    <div style="padding-bottom: 3px">
                      道具名字：
                      <span style="font-size: 18px">{{
                        value.equipment.name
                      }}</span>
                    </div>
                    <div>描述：{{ value.equipment.info }}</div>
                    <div>
                      <span>属性加成：</span>
                      <div>力量：{{ value.strength }}</div>
                      <div>体质：{{ value.defense }}</div>
                      <div>灵力：{{ value.magic }}</div>
                      <div>速度：{{ value.speed }}</div>
                      <div>命中加成：{{ value.accuracy }}</div>
                    </div>
                    <div v-if="value.skill">
                      <div>特技：{{ value.skill.name }}</div>
                      <div>
                        特技效果：
                        <div v-if="value.skill.ad != '0'">
                          获得{{ value.skill.ad }}点物理伤害加成。
                        </div>
                        <div v-if="value.skill.ap != '0'">
                          获得{{ value.skill.ap }}点法术伤害加成。
                        </div>
                      </div>
                    </div>
                    <div v-else>
                      <div>特技：无</div>
                      <div>特技描述：无</div>
                      <br />
                      <br />
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '0'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('on', value._id)"
                        >装 备</el-button
                      >
                    </div>
                    <div class="bottom clearfix" v-if="value.status == '1'">
                      <el-button
                        type="text"
                        class="button"
                        @click="equipon('off', value._id)"
                        >卸 下</el-button
                      >
                    </div>
                  </div>
                </el-card>
              </div>
            </el-col>
          </el-row> -->
        </el-tab-pane>
        <el-tab-pane label=" 功 法 " name="skill">功法</el-tab-pane>
      </el-tabs>
    </template>
  </div>
</template>

<script>
export default {
  name: "bag",
  data() {
    return {
      activeName: "good",
      userbag: [],
      equipingbag: [],
      weaponbag: [],
      clothesbag: [],
      shoebag: [],
      ringbag: [],
      upform: {
        option: "on",
        id: "",
      },
    };
  },
  created() {
    this.getUserGoodbag();
    this.getUserUsingbag();
  },
  computed: {
    user() {
      return this.$store.getters.user;
    },
  },
  methods: {
    handleClick(tab, event) {
      let now_page = event.target.getAttribute("id");
      if (now_page == "tab-good") {
        this.getUserGoodbag();
      }
      if (now_page == "tab-weapon") {
        this.getUserWeaponbag();
      }
      if (now_page == "tab-clothes") {
        this.getUserClothesbag();
      }
      if (now_page == "tab-shoe") {
        this.getUserShoebag();
      }
      if (now_page == "tab-ring") {
        this.getUserRingbag();
      }
      if (now_page == "tab-skill") {
      }
    },
    getUserGoodbag() {
      // 获取背包数据
      this.$axios
        .get("/api/goods/usergood/get")
        .then((res) => {
          this.userbag = res.data;
          //console.log(this.userbag);
        })
        .catch((err) => console.log(err));
    },
    getUserWeaponbag() {
      // 获取武器背包数据
      this.$axios
        .get("/api/equipments/user/getweaponbag")
        .then((res) => {
          this.weaponbag = res.data;
          console.log(this.weaponbag);
        })
        .catch((err) => console.log(err));
    },
    getUserClothesbag() {
      // 获取衣服背包数据
      this.$axios
        .get("/api/equipments/user/getclothesbag")
        .then((res) => {
          this.clothesbag = res.data;
        })
        .catch((err) => console.log(err));
    },
    getUserShoebag() {
      // 获取鞋子背包数据
      this.$axios
        .get("/api/equipments/user/getshoebag")
        .then((res) => {
          this.shoebag = res.data;
        })
        .catch((err) => console.log(err));
    },
    getUserRingbag() {
      // 获取戒指背包数据
      this.$axios
        .get("/api/equipments/user/getringbag")
        .then((res) => {
          this.ringbag = res.data;
        })
        .catch((err) => console.log(err));
    },
    getUserUsingbag() {
      // 获取装备中背包的数据
      this.$axios
        .get("/api/equipments/user/getusing")
        .then((res) => {
          this.equipingbag = res.data;
          console.log(this.equipingbag);
        })
        .catch((err) => console.log(err));
    },
    usebutton() {
      this.$message({
        showClose: true,
        message: "用个鸡！还没做这个功能！",
        type: "error",
      });
    },
    equipon(option, row) {
      let url;
      if (option == "on") {
        this.upform = {
          option: "on",
          id: row,
        };
        url = `equipon/${this.upform.id}`;
      }
      if (option == "off") {
        this.upform = {
          option: "off",
          id: row,
        };
        url = `equipoff/${this.upform.id}`;
      }
      this.$axios
        .post(`api/equipments/user/${url}`, this.upform)
        .then((res) => {
          console.log(res);
          // 添加成功
          this.$message({
            message: res.data.msg,
          });
          location.reload(true);
        })
        .catch((err) => {
          this.$message({
            message: "系统错误",
            type: "warning",
          });
        });
    },
    equipoff(index, row) {
      this.$message({
        showClose: true,
        message: "用个鸡！还没做这个功能！",
        type: "error",
      });
    },
  },
};
</script>
<style scoped>
.bag {
  width: 100%;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  padding: 0;
  float: right;
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}
.pagination {
  text-align: right;
  margin-top: 10px;
}
</style>